<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;
global $_IFACE_CONTROL_OBJECT;
global $_SET_TABBING;

$_SET_TABBING = true;

$lc_inv_ctl_purchase_orders = array (
	employee=>array (label=>"Employee",order=>"DEFAULT",wrapper=>"vmc_icon_method"),
	po_number=>array (label=>"PO Number",order=>"DEFAULT"),
	description=>array (label=>"Description",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	date_required=>array (label=>"Date Required",order=>"DEFAULT"),
	freight_charge=>array (label=>"Freight Charges",order=>"DEFAULT"),
	cdate=>array (label=>"Create Date",order=>"DEFAULT",wrapper=>"vmc_icon_date"),
);

$link_options_path = array (
	array (
		fs_tab=>"inv_ctl_purchase_orders",
		fs_tab_option=>"lc_inv_ctl_purchase_orders",
		object_id=>"supplier_id",
		object_value=>$_REQUEST["supplier_id"],
	)
);

$link_options = _app_create_tabbing (null, $link_options_path);

$object_ctl_path = array (
	array (
		fs_action=>"view",
		fs_tab=>"inv_ctl_purchase_orders",
		fs_tab_option=>"fs_inv_ctl_purchase_orders",
		object_id=>"supplier_id",
		object_value=>$_REQUEST["supplier_id"],
	)
);

$object_ctl = _app_create_tabbing ( "/inventory_control/_inv_ctl_suppliers/?",
		$object_ctl_path) . "&";

$list_options_path = array (
	array (
		fs_tab=>"inv_ctl_purchase_orders",
		fs_action=>"addnew",
		fs_tab_option=>"fs_inv_ctl_purchase_orders",
		object_id=>"supplier_id",
		object_value=>$_REQUEST["supplier_id"], )
);

$list_options = array (
	array (
		label=>"Create A Purchase Order",
		link=>_app_create_tabbing ("?", $list_options_path)
	),
);

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
		db_conn=>$_GLOBAL_DBH,
		indexes=>$lc_inv_ctl_purchase_orders,
		list_count=>"SELECT COUNT(*) FROM inv_ctl_purchase_orders",
		list_select=>"SELECT * FROM inv_ctl_purchase_orders",
		list_id=>"lc_inv_ctl_purchase_orders",
		list_options=>$list_options,
		primary_key=>"id",
		primary_relation=>"purchase_order_id",
		link_options=>$link_options,
		object_ctl=>$object_ctl
));

array_push ($_IFACE_CONTROL_OBJECT, $_OBJECT_IFACE_LIST);

?>
